Repository navigation
Add development reload for docket worker - #634
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a0843360ba
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ) -> None: | ||
| set_logging_level(logging_level) | ||
| set_logging_format(logging_format) | ||
| asyncio.run(worker()) |
There was a problem hiding this comment.
Bypass stale bytecode before importing reloaded tasks
With --reload, if a task module is edited to the same byte length within the same timestamp second as the bytecode currently in __pycache__ (for example, a fast before→edited rename), Python can accept that timestamp-based .pyc because it validates only the source's integer mtime and size. The watcher fires, but this invocation then imports the old bytecode and no event remains to retry, so users see the old task implementation; test_worker.py:172-177 masks this case by forcing the mtime two seconds forward. Ensure reload children bypass or remove affected bytecode before importing the task collection.
Useful? React with 👍 / 👎.
| logging_level: LogLevel, | ||
| logging_format: LogFormat, | ||
| ) -> None: | ||
| run_process( |
There was a problem hiding this comment.
Preserve the worker's graceful drain during reloads
When --reload is used while an in-flight task takes more than five seconds, this call inherits watchfiles' 5-second sigint_timeout and then force-kills the child. Worker._worker_loop intentionally waits for active tasks in worker.py:887-902, so a save or Ctrl+C cuts that drain short, leaves the stream message pending until redelivery, and contradicts the documented CLI graceful-shutdown behavior; expose or configure an adequate drain timeout rather than relying on the reloader default.
AGENTS.md reference: AGENTS.md:L97-L103
Useful? React with 👍 / 👎.
Closes #565.
Summary
docket worker --reloadfor local development. It watches Python files under the current directory and starts a fresh worker process after changes.--reloadwith--until-finished.Verification